Release 10.1A: OpenEdge Development:
Progress 4GL Reference


INTERFACE statement

Defines an interface. An interface is a special type of class definition that contains a set of method prototype declarations for common methods implemented by one or more classes. All classes that implement the interface must support the methods declared in the interface.

Note: This statement is applicable only when used in a class definition (.cls) file.

Syntax

INTERFACE type-name: 
interface-body 

type-name

A character string that specifies the type name of an interface. Specify an interface type name using the package.class-name syntax as described in the Type-name syntax reference entry in this book.

interface-body

The body of an interface definition is composed of the following types of elements:

Example

The following example shows the definition of an interface that declares two method prototypes:

INTERFACE acme.myObjs.Interfaces.IBusObj: 
  METHOD PUBLIC VOID printObj(INPUT deviceName AS CHARACTER). 
  METHOD PUBLIC VOID logObj(INPUT deviceName AS CHARACTER). 
END INTERFACE. 

The following example shows the definition of a class that implements this interface and its method declarations:

CLASS acme.myObjs.CustObj INHERITS acme.myObjs.Common.CommonObj 
  IMPLEMENTS acme.myObjs.Interfaces.IBusObj: 
         . 
         . 
         . 
/ * Implement the methods declared in the interface */ 
     METHOD PUBLIC VOID printObj(INPUT deviceName AS CHARACTER): 
         MESSAGE “In CustObj class – printObj method” VIEW-AS ALERT-BOX. 
     END METHOD. 
     METHOD PUBLIC VOID logObj(INPUT deviceName AS CHARACTER): 
         MESSAGE “In CustObj class – logObj method” VIEW-AS ALERT-BOX. 
     END METHOD. 
END CLASS. 

Notes

See also

CLASS statement, METHOD statement


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095